
EA FRactal breakout 



Extern variables:


Ativate EA  : true/false    ( option to manualy start/stop the EA without removing it from chart)

Lotsize  : 0.01  (only used if "use MoneyManagment = false)
Use Money management : true/false 
Percent to risk  : 2%
trading start hour : 00h00
trading end hour   : 22h00
close all pos on friday  : true
friday hour  :  22h00

magic nr : 12345
max stoploss distance in pips : 10
partial close @ x times risk : 2
% volume to close : 50%
fractal lookback  : 2
Slippage : 0.5
offset long : 0.5
offset short :0 

trail sl last fractal :  true

use filter : true/false   ( custom indicator)




Trading Logic
--------------

Pending Long order:

we find a LH fractal ( 2 DOWN fractals needed), this Lower DOWN Fractal value = Pending BuyStop orders (+offset long)
the StopLoss = The UP fractal found between the 2 DOWN fractals , if there is no UP fractal we will use the last UP fractal found on the chart ( if this falls between the max stopdistance)
if this last UP fractal value > the max stop distance there is no Pending BuyStop placed 

This StopLoss will be used to calculate the lotsize, as a function of the user defined % risk setting 

The Pending BuyStop order will be canceled as soon as a new Pending Order Long is found ( obviously a lower value than the previous pending )
so that never 2 pending orders are working 





Pending Short order:

we find a HL fractal ( 2 UP fractals needed), this Higher UP Fractal value = Pending SellStop orders (-offset short)
the StopLoss = The DOWN fractal found between the 2 UP fractals , if there is no DOWN fractal we will use the last DOWN fractal found on the chart ( if this falls between the max stopdistance)
if this last DOWN fractal value > the max stop distance there is no Pending SellStop placed 

This StopLoss will be used to calculate the lotsize, as a function of the user defined % risk setting 

The Pending SellStop order will be canceled as soon as a new Pending Order Short is found ( obviously a higher value than the previous pending )
so that never 2 pending orders are working 





The Partial CLose
-----------------

if a profit target has been reached ( this is defined by the "partial close @ x times risk ")
if a value of 2 is entered here and the StopLoss = 5pips
then @ 10 pips profit a partial close will happen 

How many of the psition is close is defined by "% volume to close "
If a value of 50 is entered then half the position is closed 
if a value of 70 is entered the 70% of the position will be closed 
....


Trailing StopLoss
-----------------

For a LONG order= the StopLoss value will be moved up with every new UP fractal after the entry
For a SHORT order= the StopLoss value will be moved up with every new DOWN fractal after the entry

a safty feature is build in so a Stoploss can never be adjusted bigger the the previous value

so:
for a LONG trade the Stoploss can only be moved UP
for a SHORT trade the Stoploss can only be moved down



Other 
------

All trades will be closed on a Friday and no new orders will be places after this " friday close hour"

A fractal lookback is used because in fractal ind. in metatrader sometimes displays a fractal and disappears again before the bar closes,
if we wait 2 completed bar, we are sure the fractal would not change anymore !

the pending Buy/Sell stop is places as soon as the fractal is "Fixed"   







